<?php

declare(strict_types=1);

namespace DreamCat\StateMachine\Popo;

/**
 * 前置检查失败的结果
 * @author vijay
 */
class PreConditionFailResult
{
    /** @var int 失败的错误码 */
    private int $failCode;
    /** @var string 失败的原因描述 */
    private string $failText;
    /** @var string|null 如果需要等某个事件 */
    private ?string $listenEventType = null;
    /** @var string|null 需要等待的事件key */
    private ?string $listenEventKey = null;

    /**
     * @return int|null
     */
    public function getFailCode(): ?int
    {
        return $this->failCode ?? null;
    }

    /**
     * @param int $failCode
     * @return PreConditionFailResult
     */
    public function setFailCode(int $failCode): PreConditionFailResult
    {
        $this->failCode = $failCode;
        return $this;
    }

    /**
     * @return string|null
     */
    public function getFailText(): ?string
    {
        return $this->failText ?? null;
    }

    /**
     * @param string $failText
     * @return PreConditionFailResult
     */
    public function setFailText(string $failText): PreConditionFailResult
    {
        $this->failText = $failText;
        return $this;
    }

    /**
     * @return string|null
     */
    public function getListenEventType(): ?string
    {
        return $this->listenEventType ?? null;
    }

    /**
     * @param string|null $listenEventType
     * @return PreConditionFailResult
     */
    public function setListenEventType(?string $listenEventType): PreConditionFailResult
    {
        $this->listenEventType = $listenEventType;
        return $this;
    }

    /**
     * @return string|null
     */
    public function getListenEventKey(): ?string
    {
        return $this->listenEventKey;
    }

    /**
     * @param string|null $listenEventKey
     * @return PreConditionFailResult
     */
    public function setListenEventKey(?string $listenEventKey): PreConditionFailResult
    {
        $this->listenEventKey = $listenEventKey;
        return $this;
    }
}

# end of file
